package com.atguigu.gmall.user.controller;

import com.atguigu.gmall.model.user.UserAddress;
import com.atguigu.gmall.user.service.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 用户地址管理controller 组件
 * @author : zjj
 * @date : 2021/2/5 14:50
 */

@Controller
@RequestMapping("/api/user")
public class UserAddressController {
    /**
     * 用户地址管理 service组件
     */
    @Autowired
    private UserAddressService userAddressService;

    /**
     * 通过用户id查询用户地址
     * @param userId    用户id
     * @return          用户地址列表
     */
    @GetMapping("inner/findUserAddressListByUserId/{userId}")
    public List<UserAddress> findUserAddressListByUserId(@PathVariable("userId") String userId){
        return userAddressService.findUserAddressListByUserId(userId);
    }



}
